package ch8.replaceArrayWithObject;

import java.util.Collection;
import java.util.Iterator;

public class Order {
    private Customer _customer;

    public Order(String customer){
        _customer = Customer.create(customer);
    }

    public String getCustomer() {
        return _customer.getName();
    }

    public void setCustomer(String customer) {
        this._customer = Customer.create(customer);
    }

    private static int numberOfOrdersFor(Collection orders, String customer){
        int result = 0;
        Iterator iterator = orders.iterator();
        while(iterator.hasNext()){
            Order order = (Order) iterator.next();
            if(order.getCustomer().equals(customer)) result++;
        }
        return result;
    }

    public static void main(String[] args){
        Customer.loadCustomers();
        Customer lemon_car_hire = Customer.create("Lemon Car Hire");
        System.out.println(lemon_car_hire);
    }
}
